﻿using System;
using System.Threading.Tasks;

namespace housingsafety.server.Caching.Core
{
    public interface ICache
    {
        string Name { get; }

        TItem Get<TItem>(string key);

        Task<TItem> GetAsync<TItem>(string key);

        object Get(string key, Type type = null);

        Task<object> GetAsync(string key, Type type = null);

        void Remove(string key);

        Task RemoveAsync(string key);

        void Set<TItem>(string key, TItem value, CacheEntryOptions options = null);

        Task SetAsync<TItem>(string key, TItem value, CacheEntryOptions options = null);

        T GetOrDb<T>(string v, Func<string, T> p);
    }
}
